﻿using System;
using System.Collections.Generic;
using System.Linq;

using System.Data;

using Recon.Portal.DataObjects;
using Recon.Portal.Data;

namespace Recon.Portal.Business
{
    public class UserEntity
    {
        #region: Public Constructor
        public UserEntity()
        {

        }
        #endregion

        #region: Public Methods
        public int RegisterUser(User user, string userID)
        {
            DBFactory db = new DBFactory();
            return db.RegisterUser(user, userID);
        }

        public int ModifyUser(User user, string userID)
        {
            DBFactory db = new DBFactory();
            return db.ModifyUser(user, userID);
        }

        public int changePassword(User user, string newPwd)
        {
            DBFactory db = new DBFactory();
            return db.changePassword(user, newPwd);
        }

        public int setForcePwdChange(User user)
        {
            DBFactory db = new DBFactory();
            return db.setForcePwdChange(user);
        }

        public bool ValidateUser(User user)
        {
            DBFactory db = new DBFactory();
            return db.ValidateUser(user);
        }

        public User GetUserSpecificDetails(string userID, string custID)
        {
            DBFactory db = new DBFactory();
            return db.GetUserSpecificDetails(userID, custID);
        }

        public List<User> GetUserDetailsByUserId(string UserID, string customerId)
        {
            DBFactory db = new DBFactory();
            return db.GetUserDetailsByUserId(UserID,customerId);
        }

        public List<User> GetUnauthorizedUsers(string UserId, string userType, string customerId)
        {
            DBFactory db = new DBFactory();
            return db.GetUnauthorizedUsers(UserId, userType, customerId);
        }

        public int AuthorizeUsers(string userID, List<User> lstUsers)
        {
            return (new DBFactory()).AuthorizeUsers(userID, lstUsers);
        }

        public List<DashboardData> GetDashboardData(Recon.Portal.DataObjects.User user)
        {
            DBFactory db = new DBFactory();
            return db.GetDashboardData(user);
        }

        public DataTable GetPendingInvoiceCountAndAmountForChart(string CustomerId, string UserId)
        {
            return (new DBFactory()).GetPendingInvoiceCountAndAmountForChart(CustomerId, UserId);
        }

        public int DeleteUser(String UserID)
        {
            DBFactory db = new DBFactory();
            return db.DeleteUser(UserID);
        }
        #endregion
    }
}